<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>回复</title>
    {% include 'admin/common/header.html' %}
</head>
<body>
<form class="layui-form">
    <div class="mainBox">
        <div class="main-container">
            <div class="main-container">

                <div class="layui-form-item">
                    <label class="layui-form-label">问题</label>
                    <div class="layui-input-block">
                        <textarea readonly name="content" style="height: 250px;" required lay-verify="title" autocomplete="off" placeholder="请输入问题" class="layui-textarea">{{ mes_info.content }}</textarea>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">回复</label>
                    <div class="layui-input-block">
                        <textarea name="reply" style="height: 250px;" required lay-verify="title" autocomplete="off" placeholder="请输入回复" class="layui-textarea"></textarea>
                    </div>
                </div>

            </div>
        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="mes-save">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
        </div>
    </div>
</form>
{% include 'admin/common/footer.html' %}
<script>
  layui.use(['form', 'jquery', 'element', 'upload'], function () {
      let form = layui.form
      let $ = layui.jquery
      var element = layui.element;
      var upload = layui.upload;
      var pestFile = ''


        form.on('submit(mes-save)', function (data) {
          //  权限相关
          let roleIds = ''
          $('input[type=checkbox]:checked').each(function () {
            roleIds += $(this).val() + ','
          })
          roleIds = roleIds.substr(0, roleIds.length - 1)

          data.field.id = "{{ mes_info.id }}"
          console.log("表单里的数据", data)

          $.ajax({
            url: '/pest_message/replymes',
            data: JSON.stringify(data.field),
            dataType: 'json',
            contentType: 'application/json',
            type: 'post',
            success: function (result) {
              if (result.success) {
                layer.msg(result.msg, { icon: 1, time: 1000 }, function () {
                  parent.layer.close(parent.layer.getFrameIndex(window.name))//关闭当前页
                  parent.layui.table.reload('mes-table')
                })
              } else {
                layer.msg(result.msg, { icon: 2, time: 1000 })
              }
            }
          })
          return false
        });


  })
</script>
<script>
</script>
</body>
</html>